package com.cbb.lease.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cbb.lease.mapper.CommentMapper;
import com.cbb.lease.pojo.entity.Comment;
import com.cbb.lease.pojo.vo.CommentVo;
import com.cbb.lease.service.CommentService;
import com.gsj.common.pojo.R;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @program: clms-eighth01
 * @description: CommentService的实现类
 * @author: 陈斌斌
 * @create: 2021-07-25 15:25
 **/
@Service
public class CommentServiceImpl implements CommentService {
    @Resource
    private CommentMapper commentMapper;

    @Override
    public R getComment(Integer currentPage, Integer pageSize, CommentVo comment) {
        Page<CommentVo> page = new Page<>(currentPage,pageSize);
        IPage<CommentVo> comment1 = commentMapper.getComment(page, comment);
        return R.ok().put("records",comment1.getRecords()).put("total",comment1.getTotal());
    }

    @Override
    public R delById(Integer id) {
        int i = commentMapper.deleteById(id);
        return R.ok();
    }
}
